/*实名认证*/

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:frametrim/app/app_navigator.dart';
import 'package:frametrim/utility/Tools.dart';
import 'package:frametrim/utility/screen.dart';
import 'package:frametrim/utility/sq_color.dart';
import 'package:frametrim/utility/toast.dart';
import 'package:frametrim/views/appbar_black.dart';
import 'package:frametrim/views/button_circle.dart';
import 'package:frametrim/views/input_background_view.dart';
import 'package:frametrim/views/textfield_idcardnum.dart';
import 'package:frametrim/views/textfiled_text.dart';

class CertificationPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => CertificationState();
}

class CertificationState extends State<CertificationPage> {
  TextEditingController _uNamecontroller = TextEditingController();
  TextEditingController _uIdCardcontroller = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        resizeToAvoidBottomInset: false,
        body: AnnotatedRegion(
          value: SystemUiOverlayStyle.dark,
          child: Stack(
            children: <Widget>[
              Image.asset('image/background.png',
                  fit: BoxFit.cover,
                  width: Screen.width,
                  height: Screen.height),
              Container(
                child: Column(
                  children: <Widget>[
                    AppbarCenterTitle(
                      title: '实名认证',
                      imgStr: 'image/imv_back.png',
                      titleColor: SQColor.black,
                    ),
                    SizedBox(
                      height: 40,
                    ),
                    buildHeader(),
                    SizedBox(
                      height: 60,
                    ),
                    InputBackGroundView(2, TextfieldText('请填写姓名', 11, _uNamecontroller)),
                    SizedBox(
                      height: 20,
                    ),
                    InputBackGroundView(
                        2, TextFieldIDCard('请填写身份证号', _uIdCardcontroller)),
                    SizedBox(
                      height: 50,
                    ),
                    ButtonCircleView(
                        '提交认证', SQColor.white, SQColor.color_3C64F9, save),
                  ],
                ),
              ),
            ],
          ),
        ));
  }

  /*头部logo*/
  Widget buildHeader() {
    return Column(
      children: <Widget>[
        /*圆角图片*/
        ClipRRect(
          borderRadius: BorderRadius.circular(5),
          child: Image.asset(
            'image/logo.png',
            width: 80,
            height: 80,
          ),
        ),
        SizedBox(
          height: 20,
        ),
        Text(
          '郑州劳务建设服务平台',
          style: TextStyle(
              fontSize: 20,
              color: SQColor.black,
              decoration: TextDecoration.none),
        ),
      ],
    );
  }

  /*提交认证*/
  void save() {
    /*if(_uNamecontroller.text.isEmpty){
      ToastUtils.show('请输入姓名');
      return;
    }
    if(_uIdCardcontroller.text.isEmpty){
      ToastUtils.show('请输入身份证号码');
      return;
    }
    if (!Tools.verifyCardId(_uIdCardcontroller.text)) {
      ToastUtils.show('身份证格式不正确，请检查');
      return;
    }*/
    AppNavigator.pushToFaceCheck(context);
  }
}
